package com.eskie.vmobileapp;

import java.util.ArrayList;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

//Product List Variables
public class ProductCodeActivity extends Fragment {

	ArrayAdapter<String> adapter;
	ListView listview;
	Thread thread;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.activity_code, container, false);
		listview = (ListView) view.findViewById(R.id.listviewcode);
		final ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < ProductList.productsLoad.length; ++i) {
			list.add(ProductList.productsLoad[i]);
		}
		adapter = new ArrayAdapter<String>(getActivity(),
				android.R.layout.simple_list_item_1, list);
		listview.setAdapter(adapter);

		listview.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				GlobalVar.menu = "Code";
				GlobalVar.numlist = arg2;
				new CustomDialog(getActivity(), CustomDialog.CPNumber).start();
			}
		});
		return view;
	}
	

}
